<html>
<head><meta charset="utf-8"><title>Make majority of generic function body non-generic · t-compiler/performance · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/index.html">t-compiler/performance</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html">Make majority of generic function body non-generic</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="213377455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213377455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213377455">(Oct 15 2020 at 03:40)</a>:</h4>
<p>What do you think of <a href="https://github.com/rust-lang/rust/issues/77960">https://github.com/rust-lang/rust/issues/77960</a> ?</p>



<a name="213384306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213384306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> panstromek <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213384306">(Oct 15 2020 at 06:28)</a>:</h4>
<p>I remember some compiler team members mentioning they'd want to implement transformation like this. It was discussed on internals, too, I believe.</p>



<a name="213384340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213384340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> panstromek <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213384340">(Oct 15 2020 at 06:29)</a>:</h4>
<p>As I understand it, those styles of tranformations are also a goal of polymorphization</p>



<a name="213414742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213414742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213414742">(Oct 15 2020 at 12:14)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> do you know if polymorphization would help with this?</p>



<a name="213414800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213414800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213414800">(Oct 15 2020 at 12:14)</a>:</h4>
<p>I don't think so. This would need outlining.</p>



<a name="213415007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213415007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213415007">(Oct 15 2020 at 12:16)</a>:</h4>
<p>Outlining is where the compiler moves parts of a function to the calling function? Is there a tracking issue/write-up of that somewhere?</p>



<a name="213415072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213415072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213415072">(Oct 15 2020 at 12:17)</a>:</h4>
<p>No, outlining is moving part of a function into a separate function.</p>



<a name="213415113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213415113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213415113">(Oct 15 2020 at 12:17)</a>:</h4>
<p>In this case you would outline the non-generic part into a non-generic function and then possibly inline the generic part into the caller.</p>



<a name="213415177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213415177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213415177">(Oct 15 2020 at 12:18)</a>:</h4>
<p>I don't think there is any tracking issue/write-up for this.</p>



<a name="213415402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213415402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213415402">(Oct 15 2020 at 12:20)</a>:</h4>
<p>Ok, that does sound like basically what I'm suggesting. Maybe this can be the tracking issue <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="213416269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213416269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213416269">(Oct 15 2020 at 12:27)</a>:</h4>
<p>What <span class="user-mention silent" data-user-id="133247">bjorn3</span> said seems right to me.</p>



<a name="213417722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213417722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213417722">(Oct 15 2020 at 12:39)</a>:</h4>
<p>am I mistaken in thinking that while the specific transformation described wouldn't be handled by polymorphization, the <em>goals</em> of the transformation would be ? (less monomorphizations, less LLVM IR, less code in the instruction cache)</p>



<a name="213418537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213418537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213418537">(Oct 15 2020 at 12:45)</a>:</h4>
<p>I think so, yeah</p>



<a name="213422010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213422010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213422010">(Oct 15 2020 at 13:11)</a>:</h4>
<p>I played with this idea a while ago, but it seems hard to pull off and I'm not certain it would be enough of an improvement to be worth the complexity</p>



<a name="213422177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213422177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213422177">(Oct 15 2020 at 13:12)</a>:</h4>
<p>You'd have to compute a cut of the CFG so that all generics-dependent operations are on one side, and all independent ones on the other side</p>



<a name="213422295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213422295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213422295">(Oct 15 2020 at 13:13)</a>:</h4>
<p>and then you get N outline candidates from that cut and have to figure out which ones are worth pursuing</p>



<a name="213422314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213422314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213422314">(Oct 15 2020 at 13:13)</a>:</h4>
<p><span class="user-mention silent" data-user-id="211727">Jonas Schievink</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic/near/213422010">said</a>:</p>
<blockquote>
<p>I played with this idea a while ago, but it seems hard to pull off and I'm not certain it would be enough of an improvement to be worth the complexity</p>
</blockquote>
<p>there's a proc-macro that does this already, it could measure how much of an improvement this is: <a href="https://llogiq.github.io/2019/05/18/momo.html">https://llogiq.github.io/2019/05/18/momo.html</a></p>



<a name="213422429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213422429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213422429">(Oct 15 2020 at 13:14)</a>:</h4>
<p>That only handles trivial cases</p>



<a name="213422463"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213422463" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213422463">(Oct 15 2020 at 13:14)</a>:</h4>
<p>sure, the compiler could only do trivial cases to start</p>



<a name="213422488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213422488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213422488">(Oct 15 2020 at 13:14)</a>:</h4>
<p>I'm not saying we need to do it <em>perfectly</em></p>



<a name="213423264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213423264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213423264">(Oct 15 2020 at 13:19)</a>:</h4>
<p>Not saying it's not going to work :P</p>



<a name="213423306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213423306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213423306">(Oct 15 2020 at 13:19)</a>:</h4>
<p>But doing it well quickly seems to run into a complexity nightmare</p>



<a name="213423494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213423494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213423494">(Oct 15 2020 at 13:20)</a>:</h4>
<p>I see it sort of the same as mir-opts: they don't need to cover everything, small improvements will have large impacts</p>



<a name="213423986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213423986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213423986">(Oct 15 2020 at 13:23)</a>:</h4>
<p>I expect that we'll also run into insufficient-inlining-problems if we do this</p>



<a name="213424067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213424067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213424067">(Oct 15 2020 at 13:23)</a>:</h4>
<p>IIRC SalSSA was effective at pursuing function merging opportunities among arbitrary candidate pairs and seemed to have interesting results, but since it was implemented within LLVM those interesting results were mostly on code size (with slightly worse compile times) and wouldn't help <em>our</em> compile times</p>



<a name="213424253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213424253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213424253">(Oct 15 2020 at 13:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="211727">Jonas Schievink</span> <a href="#narrow/stream/247081-t-compiler.2Fperformance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic/near/213423986">said</a>:</p>
<blockquote>
<p>I expect that we'll also run into insufficient-inlining-problems if we do this</p>
</blockquote>
<p>LLVM would be able to inline again, no? since this is happening before we pass it to the codegen backend</p>



<a name="213424934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213424934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213424934">(Oct 15 2020 at 13:28)</a>:</h4>
<p>Yeah it would, but only if a) the outlined function is in the same CGU as the callers (which we should ensure) and b) its heuristic says yes</p>



<a name="213424983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213424983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213424983">(Oct 15 2020 at 13:28)</a>:</h4>
<p>that seems doable :)</p>



<a name="213425011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213425011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213425011">(Oct 15 2020 at 13:28)</a>:</h4>
<p>easy for me to say I know :P</p>



<a name="213425036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213425036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213425036">(Oct 15 2020 at 13:29)</a>:</h4>
<p>Even if runtime perf degrades, we could run it at opt-level=0 only (but that won't help rustc_middle)</p>



<a name="213482456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213482456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213482456">(Oct 15 2020 at 20:24)</a>:</h4>
<p>Even if we <em>only</em> handled the case where the generic parts of the function consist of <code>let thing = thing.trait_method()</code>, that seems like it'd be worthwhile.</p>



<a name="213482470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213482470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213482470">(Oct 15 2020 at 20:24)</a>:</h4>
<p>That'd handle common cases like <code>AsRef</code>, for instance.</p>



<a name="213482816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Make%20majority%20of%20generic%20function%20body%20non-generic/near/213482816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Make.20majority.20of.20generic.20function.20body.20non-generic.html#213482816">(Oct 15 2020 at 20:27)</a>:</h4>
<p>We wouldn't have to do reordering, initially. We could just see if the MIR that was <em>naturally</em> generated for the function has a natural cut-point after which there are no more live generics.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>